/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SMA.models;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Emiliano
 */
@Entity
@Table(name = "NIVELATENCION")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "NivelAtencion.findAll", query = "SELECT n FROM NivelAtencion n"),
    @NamedQuery(name = "NivelAtencion.findByIdnivelatecion", query = "SELECT n FROM NivelAtencion n WHERE n.idnivelatecion = :idnivelatecion"),
    @NamedQuery(name = "NivelAtencion.findByDescripcion", query = "SELECT n FROM NivelAtencion n WHERE n.descripcion = :descripcion")})
public class NivelAtencion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "IDNIVELATECION")
    private Integer idnivelatecion;
    @Column(name = "DESCRIPCION")
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "nivelAtencion")
    private Collection<DepartamentoNivelAtencionUsuario> departamentoNivelAtencionUsuarioCollection;
    @OneToMany(mappedBy = "idNivelatencion")
    private Collection<Ticket> ticketCollection;

    public NivelAtencion() {
    }

    public NivelAtencion(Integer idnivelatecion) {
        this.idnivelatecion = idnivelatecion;
    }

    public Integer getIdnivelatecion() {
        return idnivelatecion;
    }

    public void setIdnivelatecion(Integer idnivelatecion) {
        this.idnivelatecion = idnivelatecion;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    @XmlTransient
    public Collection<DepartamentoNivelAtencionUsuario> getDepartamentoNivelAtencionUsuarioCollection() {
        return departamentoNivelAtencionUsuarioCollection;
    }

    public void setDepartamentoNivelAtencionUsuarioCollection(Collection<DepartamentoNivelAtencionUsuario> departamentoNivelAtencionUsuarioCollection) {
        this.departamentoNivelAtencionUsuarioCollection = departamentoNivelAtencionUsuarioCollection;
    }

    @XmlTransient
    public Collection<Ticket> getTicketCollection() {
        return ticketCollection;
    }

    public void setTicketCollection(Collection<Ticket> ticketCollection) {
        this.ticketCollection = ticketCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idnivelatecion != null ? idnivelatecion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NivelAtencion)) {
            return false;
        }
        NivelAtencion other = (NivelAtencion) object;
        if ((this.idnivelatecion == null && other.idnivelatecion != null) || (this.idnivelatecion != null && !this.idnivelatecion.equals(other.idnivelatecion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "SMA.models.NivelAtencion[ idnivelatecion=" + idnivelatecion + " ]";
    }
    
}
